//切换导航栏
function changeNav(index) {
    document.querySelector('nav .active').classList.remove('active');
    document.querySelector(`nav .link:nth-child(${index})`).classList.add('active');

    setTimeout(function () {
        //根据index的值去跳转
        if (index === 1) {
            location.href = './index.html';
        } else if (index === 2) {
            location.href = './subject.html';
        } else if (index === 3) {
            location.href = './all.html';
        }
    }, 300)
}